namespace PlanningPokerMVC.Migrations
{
    using System.Data.Entity.Migrations;
    
    public partial class initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "WorkItems",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        AreaPath = c.String(),
                        Description = c.String(),
                        IterationPath = c.String(),
                        Title = c.String(),
                        StateChangeDate = c.DateTime(nullable: false),
                        State = c.String(),
                        ChangedDate = c.DateTime(nullable: false),
                        ChangedBy = c.String(),
                        Status = c.String(),
                        WinningVote = c.Int(),
                        CreationTimeStamp = c.DateTime(nullable: false),
                        CreatedBy = c.String(),
                        UpdateTimeStamp = c.DateTime(nullable: false),
                        UpdatedBy = c.String(),
                        StoryPoints = c.Double(),
                        OriginalEstimate = c.Int(),
                        Remaining = c.Int(),
                        Completed = c.Int(),
                        Discriminator = c.String(nullable: false, maxLength: 128),
                        WorkItem_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("WorkItems", t => t.WorkItem_Id)
                .Index(t => t.WorkItem_Id);
            
            CreateTable(
                "VoteDetails",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                        Vote = c.Int(nullable: false),
                        Notes = c.String(),
                        CreationTimeStamp = c.DateTime(nullable: false),
                        WorkItemId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("WorkItems", t => t.WorkItemId, cascadeDelete: true)
                .Index(t => t.WorkItemId);
            
        }
        
        public override void Down()
        {
            DropIndex("VoteDetails", new[] { "WorkItemId" });
            DropIndex("WorkItems", new[] { "WorkItem_Id" });
            DropForeignKey("VoteDetails", "WorkItemId", "WorkItems");
            DropForeignKey("WorkItems", "WorkItem_Id", "WorkItems");
            DropTable("VoteDetails");
            DropTable("WorkItems");
        }
    }
}
